# -*- coding:utf-8 -*-
# @Time : 2020/8/11 8:35
# @Author : Administrator
# @File : permissions.py
# @Software: PyCharm
# @Motto: good good study,day day up

from rest_framework.permissions import BasePermission


class IsEnrolled(BasePermission):

    def has_object_permission(self, request, view, obj):
        return obj.students.filter(id=request.user.id).exists()
